package com.jk.bean;

import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
@Document(collection="userLog")
public class Log implements Serializable {


    private String id;

    private String userAccout;

    @DateTimeFormat(pattern="yyyy-MM-dd")//接收前台的格式
    private Date addTime;

    private String  name;

    private String version;

    private String phone;

    public Log() {
    }

    public Log(String userAccout, Date addTime, String name, String version, String phone) {
        this.userAccout = userAccout;
        this.addTime = addTime;
        this.name = name;
        this.version = version;
        this.phone = phone;
    }


    @Override
    public boolean equals(Object o) {

        if (this == o){
            return true;
        }

        if (!(o instanceof Log)){
            return false;
        }
        Log log = (Log) o;
        return getId().equals(log.getId()) &&
                getUserAccout().equals(log.getUserAccout()) &&
                getAddTime().equals(log.getAddTime()) &&
                getName().equals(log.getName()) &&
                getVersion().equals(log.getVersion()) &&
                getPhone().equals(log.getPhone());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getUserAccout(), getAddTime(), getName(), getVersion(), getPhone());
    }
}
